package com.suda.catalina.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Created by gzy on 2016/3/14.
 */
public class SettingFragment extends Fragment {

    private TextView textView;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.tab_setting, null);
        textView = (TextView) view.findViewById(R.id.settingName);
        view.findViewById(R.id.setting_personal).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(getContext(), PersonalActivity.class));
            }
        });
        view.findViewById(R.id.setting_set).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(getContext(), SettingActivity.class));
            }
        });
        view.findViewById(R.id.settingTwoCode).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(getContext(), TwoCodeActivity.class));
            }
        });
        return view;
    }

    @Override
    public void onResume() {
        super.onResume();
        String data = EditFile.loadData(getActivity());
        if (!TextUtils.isEmpty(data)) {
            textView.setText(data);
        }
    }
}
